<template>
	<view class="area-content" :style="{'height': page_height - height + 'px'}">
		<view class="stab">
			<view class="stab-title">
				<scroll-view scroll-y>
					<view class="nav-list">
						<view class="nav-list-item1" :class="{active: currentIndex1 === index}" v-for="(item,index) in nav1" :key="index" @click="changeTab1(index)">
							{{item.name}}
						</view>
					</view>
				</scroll-view>
			</view>
			<view class="stab-content">
				<scroll-view scroll-y>
					<view class="nav-list">
						<view class="nav-list-item2" :class="{active: currentIndex2 === index}" v-for="(item,index) in nav2" :key="index" @click="changeTab2(index)">
							{{item.name}}
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			nav1: {
				type: Array,
				default() {
					return []
				}
			},
			nav2: {
				type: Array,
				default() {
					return []
				}
			},
			height: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				page_height: uni.getSystemInfoSync().windowHeight,
				currentIndex1: 0,
				currentIndex2: 0,
			}
		},
		methods:{
			changeTab1(index) {
				this.currentIndex1 = index
				this.$emit('change-tab1',index)
			},
			changeTab2(index) {
				this.currentIndex2 = index
				this.$emit('change-tab2',index)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.stab {
		display: flex;
		height: 100%;
	}
	
	.stab-title {
		flex-shrink: 0;
		width: 260rpx;
		height: 100%;
		background-color: #f5f5f5;
	}
	
	.stab-content {
		flex-grow: 1;
		height: 100%;
		background-color: #fff;
	}
	
	.nav-list {
		
	}
	
	.nav-list-item1 {
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 30rpx;
		
		&.active {
			background-color: #fff;
			color: #00B4FF;
		}
	}
	
	.nav-list-item2 {
		height: 80rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		box-sizing: border-box;
		padding: 0 60rpx;
		font-size: 30rpx;
		
		&.active {
			background-color: #fff;
			color: #00B4FF;
		}
	}
</style>
